package cn.net.xyan.yypt.entity

import cn.net.xyan.blossom.core.support.DateTableSequenceGenerator
import cn.net.xyan.blossom.kotlin.NoArg
import org.hibernate.annotations.GenericGenerator
import java.math.BigDecimal
import java.util.*
import javax.persistence.*

@NoArg
@Entity
@Table(name = "payOrder")
data class PayOrder(var outTradeNo:String,val subject:String){

    @Temporal(TemporalType.TIMESTAMP)
    @Column(nullable = false)
    var createDate = Date()

    @Temporal(TemporalType.TIMESTAMP)
    @Column(nullable = false)
    var lastModifyDate = Date()

    @Temporal(TemporalType.TIMESTAMP)
    var refundDate: Date? = null

    @Id
    @GeneratedValue(strategy = GenerationType.SEQUENCE, generator = "orderSequence")
    @GenericGenerator(name = "orderSequence", strategy = DateTableSequenceGenerator.STRATEGY)
    var orderID:String? = null

    @Column(columnDefinition = "DECIMAL(12,2)",nullable = false)
    var tradeFee: BigDecimal = BigDecimal.ZERO

    @Column(columnDefinition = "DECIMAL(12,2)",nullable = false)
    var totalFee = tradeFee

    @Column(columnDefinition = "DECIMAL(12,2)")
    var payFee: BigDecimal = BigDecimal.ZERO

    var payVendor:String? = null

    var payVendorNo:String? = null

    var status:Int? = null

    var type:String? = null

   // @OneToMany(mappedBy = "order")
   // val payRecords:MutableList<PayRecord> = LinkedList<PayRecord>()

    @Column(length = 4000)
    var attach:String? = null

}